import { AnimationClip, AnimationComponent } from 'cc'
import { StateMachine } from '../../Base/StateMachine'
import { State } from '../../Base/AnimationState'

export enum DOOR_STATE {
  IDLE_TOP = 'idle_top', //待机-上
  IDLE_LEFT = 'idle_left', //待机-左
  DEATH = 'death', //死亡
}

export class DoorStateMachine extends StateMachine<DOOR_STATE> {
  constructor(private _animationComponent: AnimationComponent) {
    super()
    this.initStateMap()
  }
  initStateMap() {
    const acp = this._animationComponent
    const idleBaseUrl = 'texture/door/idle'
    const deathBaseUrl = 'texture/door/death'
    this.addState(DOOR_STATE.IDLE_TOP, new State(acp, `${idleBaseUrl}/top`))
    this.addState(DOOR_STATE.IDLE_LEFT, new State(acp, `${idleBaseUrl}/bottom`))
    this.addState(DOOR_STATE.DEATH, new State(acp, `${deathBaseUrl}/death`))
  }
}
